<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@page import="com.ch7.model.*"%>
<%@page import="com.ch7.dal.Class"%>
<%@page import="com.ch7.dal.Blog"%>
<%@page import="com.ch7.common.DataValidator"%>
<%@page import="com.ch7.common.Utility"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

<%
	Blog blog = new Blog();
	List<BlogInfo> list = blog.getList(null);
	Class cls = new Class();
	List<ClassInfo> clist = cls.getList();
%>
</head>

<body background="Image/timg.jpg" width=100% height=100%>

<div class="header">
<style>
.header{ background:url(Image/2.jpg) no-repeat left top; height:618px;}}
</style>

</div>
    
    
	<div id="content">
		<%
			for (BlogInfo info : list) {
		%>
		<div class="post">
			<h1 class="title">
				<a href="blog-information.jsp?id=<%=info.getId()%>"><%=info.getTitle()%></a>
			</h1>
			<p class="byline">
				<small><%=info.getCreatedtime()%></small>
			</p>
			<div class="entry">
				<p>
					<%=Utility.Substring(DataValidator.removeHtml(info.getContext()), 300)%></p>
			</div>
			<p class="meta">
				<a href="#" class="more">分类：<%=info.getClassName()%></a>&nbsp;&nbsp;&nbsp;<a
					href="#" class="more">詳情</a>&nbsp;&nbsp;&nbsp; <a
					href="blog-information.jsp?id=<%=info.getId()%>#comment"
					class="comments"> 我要评论</a>
			</p>
		</div>
		<%
			}
		%>
	</div>

	<div id="sidebar">
		<ul>
			<li>
				<h2>日志分类</h2>
				<ul>
					<%
						for (ClassInfo cinfo : clist) {
					%>
					<li><a href="blog-list.jsp?classId=<%=cinfo.getId()%>"><%=cinfo.getName()%></a></li>
					<%
						}
					%>
				</ul>
			</li>
		</ul>
	</div>
</body>
</html>
